           <? if ($idBuilding) {    
               $query = mysql_query("SELECT * FROM building
            WHERE id_building = '$idBuilding';");
        

        
        while ( $result = mysql_fetch_array($query) ) {
            ?>
			<div class="cont_coloumn left">
				<div class="wth_dash">
                                    
                                    <a href="#" onClick="backToBC(); return false;">Вернуться к списку БЦ-ов</a>
                                    <BR>
                                    <BR>
					<span class="about_co" id="nBuild"><?echo $result['name'];?></span>
					<span> <? echo $result['address'];?></span><br />
					<span><b>Телефон:</b>&nbsp<? echo $result['phone'];?></span><br />
					<span><b>Сайт:</b> <a href="<? echo $result['site'];?>"><? echo $result['site'];?></a></span>
					<span class="vid_gr mt20">
                                            <?
                                            $query4 = mysql_query("SELECT count( id_building ) AS col
                                                FROM building
                                                LEFT JOIN building_offices
                                                USING ( id_building )
                                                LEFT JOIN firms
                                                USING ( id_office )
                                                WHERE NOT isnull( number )
                                                AND isnull( id_firm )
                                                AND id_building = '".$result['id_building']."'");
                                            $result4 = mysql_fetch_array($query4);
                                            echo $result4['col'];
                                            ?>
                                            
                                            
                                            свободных офисов</span>
				</div>
				<div class="wth_dash">	
					<span class="title_col">Описание здания</span>
					<p><b>Тип здания:</b> <?
                                        
                                        switch ( $result['type'] ) {
                                            
                                            case "0":
                                                echo "";
                                            break;
                                            
                                            case "1":
                                                echo "Бизнес центр";
                                            break;
                                        
                                            case "2":
                                                echo "Торгово-развлекательный центр";
                                            break;
                                        
                                            case "3":
                                                echo "Отдельно стоящее здание";
                                            break;
                                            
                                            case "4":
                                                echo "Государственное учреждение";
                                            break;
                                        
                                            case "5":
                                                echo "Жилое здание";
                                            break;
                                        
                                            case "6":
                                                echo "Завод";
                                            break;
                                        
                                            case "7":
                                                echo "Другое";
                                            break;
                                            
                                        }?></p>
					<p><b>Класс:&nbsp</b><?
                                        
                                        
                                            switch ( $result['class'] ) {
                                            case "0":
                                                echo "";
                                            break;
                                            
                                            case "1":
                                                echo "A";
                                            break;
                                        
                                            case "2":
                                                echo "A+";
                                            break;
                                        
                                            case "3":
                                                echo "A-";
                                            break;
                                            
                                            case "4":
                                                echo "B";
                                            break;
                                        
                                            case "5":
                                                echo "B+";
                                            break;
                                        
                                            case "6":
                                                echo "B-";
                                            break;
                                        
                                            case "7":
                                                echo "C";
                                            break;
                                        
                                            case "8":
                                                echo "C+";
                                            break;
                                        
                                            case "9":
                                                echo "C-";
                                            break;
                                        
                                            case "10":
                                                echo "D";
                                            break;
                                            
                                        }?> 
                                        </p>
					<p><b>Год постройки:</b>&nbsp<? echo $result['year_building'];?></p>
					<p><b>Этажность:</b>&nbsp<? echo $result['floors'];?></p>
					<p><b>Общая площадь:</b>&nbsp<? echo $result['square'];?></p>
				</div> 	
			</div> 
			<div class="cont_coloumn right">
				<div class="geo_map_off">
                                        <div id="map_canvas" style="margin: 20px auto; padding: 20px">
                                        </div>
                                </div>
                            
                            
                            
                            
                            
                            
                            
                            
                            
                            
                            
                            <span>
                                    <?$query1 = mysql_query("SELECT firms.name, firms.id_firm
                                        FROM firms
                                        LEFT JOIN building_offices
                                        USING ( id_office )
                                        LEFT JOIN building
                                        USING ( id_building )
                                        WHERE id_building = '$idBuilding'
                                        LIMIT 0, 3");
                                    ?> 
                                
                                    <p><b>Арендаторы:</b></p>   
                                    
                                    <?
                                    if ( $query1 ){
                                        while ( $result1 = mysql_fetch_array($query1) ){
                                           ?>
                                    <p><a href="#"><? echo $result1['name'];?></a><br /><span class="vid_gr">
                                            <?
                                            $query2 = mysql_query("SELECT count(vacancy.name) AS col
                                                FROM vacancy
                                                LEFT JOIN firms
                                                USING (id_firm)
                                                WHERE id_firm = '".$result1['id_firm']."'");
                                          
                                            $result2 = mysql_fetch_array($query2);
                                            echo $result2['col'];
                                            ?> вакансии</span></p><?
                                           
                                           }
                                    } else {
                                        
                                        echo 'Нет арендаторов';
                                    }
                                    ?>


                                </span>
                            
                            
                            
                            
                            
                            
                            
                            
                            
                            
                            
                            
                            
                        </div>
			<div class="clear"></div> 
			<div class="plan">
				<ul class="plan_u">
					<li><b>Планировка:</b></li>
                                        <? for ($i = 1; $i <= $result['floors']; $i++){ ?>
					<li><a href="#" onClick="showPlan(<?echo $i;?>); return false;"><? echo $i; ?> этаж</a></li> <?}?>
				</ul>
				<div class="plan_map"><div id="showPlan" style="float: left;"></div></div>
                                <BR>
			</div>
                        

                        
		</div> 
    <input type="hidden" id="lat" value="<?echo $result['lat']?>">
    <input type="hidden" id="lng" value="<?echo $result['lng']?>">
              
              
              
              
              
              
              
              <?}
           }
              ?>